package cn.tude;

import java.io.File;
import java.util.Scanner;

public class Test_delete {
    public static void main(String[] args) {
        System.out.println("请输入文件名");
        String q=new Scanner(System.in).nextLine();
        File dir =new File(q);
        del(dir);
        System.out.println("已删除");

    }
    public static void del(File wjj){
       File[]fs=wjj.listFiles();
        for (int i = 0; i <fs.length ; i++) {
            if (fs[i].isFile()){
                fs[i].delete();
            }else if (fs[i].isDirectory()){
                del(fs[i]);
            }

        }
           wjj.delete();
    }
}
